6ee2663efeabe38775417c3b7decf8f48d5653b7,python/src/com/jetbrains/python/psi/types/PyTypeParser.java,PyTypeParser,parse,#PsiElement#String#,134
Before Change
}
})
.or(classType.thenSkip(op("of")).then(simpleExpr)
.map(new Function<Pair<ParseResult, ParseResult>, ParseResult>() {
@Override
public ParseResult fun(Pair<ParseResult, ParseResult> value) {
final ParseResult firstResult = value.getFirst();
final ParseResult secondResult = value.getSecond();
final ParseResult result = firstResult.merge(secondResult);
final PyType firstType = firstResult.getType();
final PyType secondType = secondResult.getType();
if (firstType != null) {
if (firstType instanceof PyClassType && secondType != null) {
return result.withType(new PyCollectionTypeImpl(((PyClassType)firstType).getPyClass(), false,
Collections.singletonList(secondType)));
}
return result.withType(firstType);
}
return EMPTY_RESULT;
}
}))
.or(classType.thenSkip(op("from")).then(simpleExpr).thenSkip(op("to")).then(simpleExpr)
.map(new Function<Pair<Pair<ParseResult, ParseResult>, ParseResult>, ParseResult>() {
@Override
public ParseResult fun(Pair<Pair<ParseResult, ParseResult>, ParseResult> value) {
final Pair<ParseResult, ParseResult> firstPair = value.getFirst();
final ParseResult first = firstPair.getFirst();
final ParseResult second = firstPair.getSecond();
final ParseResult third = value.getSecond();
final PyType firstType = first.getType();
if (firstType instanceof PyClassType) {
final List<PyType> elementTypes = Arrays.asList(second.getType(), third.getType());
final PyCollectionTypeImpl type = new PyCollectionTypeImpl(((PyClassType)firstType).getPyClass(), false,
elementTypes);
return first.merge(second).merge(third).withType(type);
}
return EMPTY_RESULT;
}
}))
.named("param-expr");
final FunctionalParser<ParseResult, PyElementType> callableExpr =
op("(").skipThen(maybe(typeExpr.then(many(op(",").skipThen(typeExpr))))).thenSkip(op(")")).thenSkip(op("->")).then(typeExpr)
After Change
}
return EMPTY_RESULT;
}))
.named("param-expr");
final FunctionalParser<ParseResult, PyElementType> callableExpr =
op("(").skipThen(maybe(typeExpr.then(many(op(",").skipThen(typeExpr))))).thenSkip(op(")")).thenSkip(op("->")).then(typeExpr)